<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="客户名称">
              <a-input placeholder="请输入客户名称" v-model="queryParam.custName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="公司名称">
              <a-input placeholder="请输入公司名称" v-model="queryParam.companyName"></a-input>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            删除
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
        selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <tpmAct-modal ref="modalForm" @ok="modalFormOk"></tpmAct-modal>
  </a-card>
</template>

<script>
  import '@/assets/less/TableExpand.less'
  import TpmFeePoolModal from './modules/TpmFeePoolModal'
  import {PageListMixin} from '@/mixins/PageListMixin'
  import {getAction} from '@/api/manage'

  export default {
    name: "TpmFeePoolList",
    mixins: [PageListMixin],
    components: {
      TpmFeePoolModal
    },
    data() {
      return {
        description: '费用池管理页面',
        processModalVisible: null,
        activeKeyAll: [],
        activeKey: [],
        processDataMap: {},
        searchProcessKey: null,
        addApplyLoading: false,
        lcModa: {
          title: '',
          disabled: false,
          visible: false,
          formComponent: null,
          isNew: false,
          businessid: '',
        },
        form: {
          priority: 0,
          assignees: [],
          sendMessage: true
        },
        modalVisible: false,
        showAssign: false,
        assigneeList: [],
        isGateway: false,
        dictPriority: [],
        submitLoading: false,
        error: "",
        /*审批历史*/
        modalLsVisible: false,
        procInstId: '',
        modalCancelVisible: false,
        cancelForm: {},
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: "center",
            scopedSlots: {customRender: 'action'},
          },

          {
            title: '费用池编码',
            align: "center",
            dataIndex: 'poolCode'
          },
          {
            title: '审批状态',
            align: "center",
            dataIndex: 'bpmStatus_dictText'
          },

          {
            title: '客户编码',
            align: "center",
            dataIndex: 'custCode'
          },
          {
            title: '客户名称',
            align: "center",
            dataIndex: 'custName'
          },
          {
            title: '公司编码',
            align: "center",
            dataIndex: 'companyCode'
          },
          {
            title: '公司名称',
            align: "center",
            dataIndex: 'companyName'
          },
          {
            title: '费用余额',
            align: "center",
            dataIndex: 'feeUsableAmount'
          },
          {
            title: '费用总额',
            align: "center",
            dataIndex: 'feeAmount'
          },
          {
            title: '币种',
            align: "center",
            dataIndex: 'moneyUnits'
          },
          {
            title: '支付方式',
            align: "center",
            dataIndex: 'payType'
          },
          {
            title: '更新时间',
            align: "center",
            dataIndex: 'updateDate'
          },
          {
            title: '更新人姓名',
            align: "center",
            dataIndex: 'updateName'
          },
          {
            title: '停用启用状态',
            align: "center",
            dataIndex: 'status',
            customRender: function (text) {
              if (text === '009') {
                return '启用'
              } else {
                return '停用'
              }
            }
          },
          {
            title: '是否删除',
            align: "center",
            dataIndex: 'deleteStatus',
            customRender: function (text) {
              if (text === '009') {
                return '否'
              } else {
                return '是'
              }
            }
          },
          {
            title: '备注',
            align: "center",
            dataIndex: 'remarks'
          }
        ],
        url: {
          list: window._CONFIG['domianTpmURL'] + "/tpmFeePoolController/findPageList",
          // delete:window._CONFIG['domianTpmURL']+ "/act/tpmAct/delete",
          // deleteBatch:window._CONFIG['domianTpmURL']+ "/act/tpmAct/deleteBatch",
          // exportXlsUrl: "act/tpmAct/exportXls",
          // importExcelUrl: "act/tpmAct/importExcel",
          // getProcessDataList: window._CONFIG['domianTpmURL']+"/activiti_process/listData",
          // getInfo:window._CONFIG['domianTpmURL']+"/act/tpmAct/getInfo",
        },
      }
    },
    computed: {

    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>